import axios from '@/libs/request'

export const create = () => {
  return axios.request({
    url: '/wl/create',
    type: 'get',
    php: true
  })
}
// 档案材料修改（新）
export const updateCLState = (data) => {
  return axios.request({
    url: '/api/ac/dangan/recordConnectionService/updateCLState',
    data: data,
    type: 'post',
    await: true
  }).catch(ret => {
    console.log('接口发生错误', ret)
  })
}
// 查询机构信息（所有操作前调用）
export const getOfficeInfo = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/getOfficeInfo',
    data: data,
    type: 'post'
  })
}
// 修改全宗号
export const updateRecordNumber = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/updateRecordNumber',
    data: data,
    type: 'post'
  })
}
// 数据导入前身份证校验
export const validateUniqueCardnoList = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/validateUniqueCardnoList',
    data: data,
    type: 'post'
  })
}
// 数据导入(通用)
export const saveExcelData = (data) => {
  return axios.request({
    url: '/api/ac/dangan/excelService/saveExcelData',
    data: data,
    type: 'post'
  })
}
// 数据导入(档案)
export const saveRecordpl = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/saveRecordpl',
    data: data,
    type: 'post'
  })
}

/**
 * 获取列表
 * @param data
 * @returns {*}
 */
export const recordList = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/getRecordList',
    data: data,
    type: 'post'
  })
}

/**
 * 新增接口
 * @param data
 * @returns {*}
 */
export const saveAndUpdateUser = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/saveUser',
    data: data,
    type: 'post'
  })
}

export const getRecordById = (id) => {
  return axios.request({
    url: '/api/as/dangan/record/getRecordById ',
    data: { id: id },
    type: 'post'
  })
}
/**
 * 档案转送
 * @param data
 * @returns {*}
 */
export const updaterecordConnection = (data) => {
  return axios.request({
    url: '/api/ac/dangan/recordConnectionService/updaterecordConnection ',
    data: data,
    type: 'post'
  })
}
/**
 * 档案转送列表
 * @param data
 * @returns {*}
 */
export const getRecordConnectionList = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/getRecordConnectionList',
    data: data,
    type: 'post'
  })
}
/**
 * 分配流水号
 * @param data
 * @returns {*}
 */
export const updateSerialNum = (data) => {
  return axios.request({
    url: '/api/ac/dangan/recordConnectionService/updateSerialNum',
    data: data,
    type: 'post'
  })
}
/**
 *  接收档案
 * @param data
 * @returns {*}
 */
export const updateRecordState = (data) => {
  return axios.request({
    url: '/api/ac/dangan/recordConnectionService/updateRecordState',
    data: data,
    type: 'post'
  })
}
export const getRecordZSList = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/getRecordZSList',
    data: data,
    type: 'post'
  })
}
/**
 * 档案列表数量统计
 * @param data
 * @returns {*}
 */
export const getRecordNum = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/getRecordNum',
    data: data,
    type: 'post'
  })
}
/**
 * 材料列表数量统计
 * @param data
 * @returns {*}
 */
export const getMaterialTypePersonalNum = (id) => {
  return axios.request({
    url: '/api/as/dangan/record/getMaterialTypePersonalNum',
    data: { achieve_id: id },
    type: 'post'
  })
}
/**
 * 档案接收数量统计
 * @param data
 * @returns {*}
 */
export const getRecordJSNum = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/getRecordJSNum',
    data: data,
    type: 'post'
  })
}
/**
 * 获取接收机构
 * @param data
 * @returns {*}
 */
export const getOfficeList = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/getOfficeList',
    data: data,
    type: 'post'
  })
}
/**
 * 获取单个人的档案材料数据列表
 * @param data
 * @returns {*}
 */
export const getPersonalMaterialList = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/getPersonalMaterialList',
    data: data,
    type: 'post'
  })
}
/**
 * 档案材料增删改查
 * @param data
 * @returns {*}
 */
export const savePersonalMaterial = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/savePersonalMaterial',
    data: data,
    type: 'post',
    await: true
  }).catch(ret => {
    console.log('接口发生错误', ret)
  })
}
/**
 * 批量删除
 * @param data
 * @returns {*}
 */
export const delMaterialAll = (data) => {
  return axios.request({
    url: '/api/as/dangan/record/deleteMaterialbatch',
    data: data,
    type: 'post',
    await: true
  }).catch(ret => {
    console.log('接口发生错误', ret)
  })
}
